package com.dao.imp;
import com.dao.UpdateGoodsDao;
import com.entity.Good;
import com.util.DBConn;

import java.sql.ResultSet;
import java.util.ArrayList;

import com.dao.DeleteGoodsDao;

public class AddUpdDelDaoImp implements DeleteGoodsDao, UpdateGoodsDao {
//    DELETE FROM table_name WHERE some_column=some_value;

    @Override
    public boolean deleteGoods(String goodsId){
        String sql = "DELETE FROM goods WHERE good_id='"+goodsId+"'";
//        System.out.println(sql);
//        return false;
        return addUpdDelGoods(sql);
    }

    @Override
    public boolean updateGoods(Good good){
        return false;
    }

    
    public boolean addUpdDelGoods(String sql) {
        boolean ret = false;
        try {
            DBConn.init();
            if(DBConn.addUpdDel(sql)!=0){
                ret=true;
            }
//            DBConn.closeConn();
        } catch (Exception e) {
            //
        }
        return ret;
    }
}
